package top.mybatisx.business.service;

import top.mybatis.dingding.DingDingClockInPluginImpl;
import top.mybatis.weixin.WeixinClockInPluginImpl;
import top.mybatisx.ClockInPlugin;
import top.mybatisx.business.plugin.ClockInPluginImpl;
import top.mybatisx.business.plugin.ClockType;

/**
 * 考勤业务使用插件
 */
public class ClockInService {

    /**
     * 考勤执行
     */
    public void clickIn(ClockType clockType) {

        // 初始化插件
        ClockInPlugin clockInPlugin = switch (clockType) {
            case sytem -> new ClockInPluginImpl();
            case dingding -> new DingDingClockInPluginImpl();
            case weixin -> new WeixinClockInPluginImpl();
        };

        clockInPlugin.install();
        clockInPlugin.turnData();
        clockInPlugin.importData();
        clockInPlugin.destory();
    }
}
